﻿Public Class AlbumsWithTags
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim tagName As String = Request.QueryString("TagName")
        Dim TC As Integer = tag(tagName)
        If TC = 0 Then
            lbl_norecords.Text = " ***** Now Records Found ******"
        End If

    End Sub
    Protected Function tag(ByVal Tname As String) As Integer
        Dim _tagCount As Integer
        Dim conn As OleDb.OleDbConnection = New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("SingerProfileConStr").ConnectionString)
        conn.Open()
        Dim sql As String = " Select Count(*) AS countTag from Albums where Tag_ID = (Select ID from AlbumsWithTags where Tag = '" & Tname & "') "
        Dim cmd As OleDb.OleDbCommand = New OleDb.OleDbCommand(sql, conn)
        Dim Dreader As OleDb.OleDbDataReader

        Dreader = cmd.ExecuteReader()
        Dreader.Read()
        _tagCount = CDbl(Dreader("countTag"))

        conn.Close()
        cmd.Dispose()
        conn.Dispose()
        Return _tagCount
    End Function
End Class